package com.ec.log.modules.log.feign;

import com.ec.core.common.core.api.Result;
import com.ec.core.common.core.api.ResponseMsg;
import com.ec.core.common.utils.BeanUtilEx;
import com.ec.log.api.modules.log.dto.HandlerLogDTO;
import com.ec.log.api.modules.log.feign.ILogFeign;
import com.ec.log.modules.log.entity.SysLog;
import com.ec.log.modules.log.service.ISysLogService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @description:
 * @author: Eric Lee
 * @time: 2021/8/21 12:49
 */
@RestController
public class LogFeign implements ILogFeign {
    @Resource
    private ISysLogService sysLogService;

    @Override
    @PostMapping("/log-feign/record-handler-log")
    public Result<Void> recordHandlerLog(HandlerLogDTO handlerLogDTO) {
        SysLog sysLogEntity = new SysLog();
        BeanUtilEx.copyProperties(handlerLogDTO, sysLogEntity);
        sysLogService.save(sysLogEntity);
        return ResponseMsg.success();
    }
}
